package com.yjhb.android.sbz.fragment;

import android.graphics.Color;
import android.view.View;

import com.yjhb.android.sbz.R;
import com.yjhb.android.sbz.view.CustomerServiceLayout;
import com.jojo.android.zxlib.base.BaseFragment;
import com.jojo.android.zxlib.base.mvp.BasePresenter;
import com.tencent.imsdk.v2.V2TIMConversation;
import com.tencent.qcloud.tim.uikit.component.TitleBarLayout;
import com.tencent.qcloud.tim.uikit.modules.chat.base.ChatInfo;

import butterknife.BindView;

import static android.view.View.GONE;

/**
 * 创建者 zx
 * 创建时间 2021/2/23 10:40
 */
public class CustomerServiceFragment extends BaseFragment {
    private final String TAG = "CustomerServiceFragment";
    @BindView(R.id.chat_layout)
    CustomerServiceLayout chatLayout;

    private ChatInfo mChatInfo;
    private TitleBarLayout mTitleBar;

    @Override
    protected BasePresenter initPresenter() {
        return null;
    }

    @Override
    protected int getLayoutId() {
        return R.layout.fragment_customer_service;
    }

    @Override
    protected void initUI() {
        chatLayout.initDefault();
        initChatInfo();
        chatLayout.setChatInfo(mChatInfo);
        chatLayout.getInputLayout().disableSendFileAction(true);
        chatLayout.getInputLayout().disableVideoRecordAction(true);
        mTitleBar = chatLayout.getTitleBar();
        mTitleBar.setLeftIcon(R.mipmap.back_w);
        mTitleBar.getMiddleTitle().setTextColor(Color.WHITE);
        mTitleBar.setBackgroundColor(getResources().getColor(R.color.colorPrimaryDark));
        mTitleBar.getRightGroup().setVisibility(GONE);
        //单聊面板标记栏返回按钮点击事件，这里需要开发者自行控制
        mTitleBar.setOnLeftClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                getActivity().finish();
            }
        });
    }

    private void initChatInfo(){
        mChatInfo = new ChatInfo();
        mChatInfo.setId("14");
        mChatInfo.setChatName("在线客服");
        mChatInfo.setType(V2TIMConversation.V2TIM_C2C);
    }

    @Override
    protected void initEvent() {

    }

    @Override
    protected void initData() {

    }
}
